<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@page contentType="text/html;charset=UTF-8" %>

<!-- Main account area -->

<div class="grid_19 clearfix">


    <h1>Address Book</h1>

    <div class="account_section">
        <div class="order_border address_summary clearfix">
            <!-- Display addresses -->
            <c:if test="${isEdit}">
                <div id="message_indicator" class="message_border clearfix">
                    <dl id="address_message" class="success">
                        <dd>
                            <img src="resource_account_files/icon_mes.png" alt="">
                        </dd>
                        <dd>
                            <h2>
                                Address was changed successfully
                            </h2>
                        </dd>
                    </dl>
                </div>
            </c:if>

            <!-- Error block -->


            <!--  Define column titles -->
            <div class="pre_module_padding">
                <dl class="pre_address_book">
                    <dd>
                        <strong>Address</strong>
                    </dd>


                    <dd class="address_status">
                        <strong>Delivery</strong>
                    </dd>


                    <dd class="action_buttons">
                        <strong>Action</strong>
                    </dd>
                </dl>
            </div>


            <c:forEach items="${addressdSet}" var="addressd" varStatus="status">
                <div class="module_padding">
                    <dl class="address_book">
                        <dd>
                            <p>

                            <div class="mini_address">
                                <div class="name">
                                    <span class="title">${addressd.title}</span>

                                    <span class="firstname">${addressd.firstName}</span>
                                    <span class="lastname">${addressd.lastName}</span>
                                </div>
                                <!-- END: name -->

                                <div class="address">
                                    <div class="street">
                                        <div class="line1">
                                                ${addressd.address}
                                        </div>

                                        <div class="line2">
                                                ${addressd.address2}
                                        </div>

                                    </div>
                                    <!-- END: street -->
                                    <div class="location">
                                        <span class="zip">${addressd.postCode}</span>

                                        <span class="city">${addressd.phone}</span>&nbsp;

                                    </div>
                                    <!-- END: location -->
                                    <div class="country">
                                        United Kingdom
                                    </div>
                                </div>
                                <!-- END: address -->
                            </div>
                            <!-- END: miniaddress -->


                            </p>
                        </dd>


                        <dd class="address_status">
                            <p>
                                <c:if test="${addressd.isPrimary}">
                                    Default Address
                                </c:if>
                                <c:if test="${!addressd.isPrimary}">
                                    <a href="/myAccountAddressDefault?id=${addressd.id}">
                                        <span>Make Delivery Address</span>
                                    </a>
                                </c:if>


                            </p>
                        </dd>


                        <dd class="action_buttons">
                            <a class="button negative step_forward"
                               href="/myAccountAddressAdd?id=${addressd.id}">
                                <span>Edit</span>
                            </a>
                            <a class="button negative step_forward"
                               href="/myAccountAddressDelete?id=${addressd.id}">
                                <span>Delete Address</span>
                            </a>
                        </dd>
                    </dl>
                </div>
            </c:forEach>

            <div class="order_view">
                <a class="button positive step_forward"
                   href="/myAccountAddressAdd"
                   title="Add New Address">
                    <span>Add New Address</span>

                </a>
            </div>


            <script type="text/javascript"><!--
            /*jQuery(document).ready(function() {
             jQuery(".selectDefault").click(function() {
             var setDefaultURL = app.util.appendParamToURL("/on/demandware.store/Sites-ROE-Site/en_GB/Address-SetDefault", "AddressID", this.value);
             window.location.href = setDefaultURL;
             });

             jQuery(".editButton").click(function(e) {
             var url = app.util.appendParamToURL("/on/demandware.store/Sites-ROE-Site/en_GB/Address-Edit", "AddressID", jQuery(this).attr('name'));
             app.dialog.open(url, "Edit Address");
             });

             jQuery(".deletelink").click(function() {
             var accepted = confirm("Do you want to remove this address?");
             if( accepted ) {
             var deleteURL = app.util.appendParamToURL("/on/demandware.store/Sites-ROE-Site/en_GB/Address-Delete", "AddressID", jQuery(this).attr('name'));
             window.location.href = deleteURL;
             }
             });
             });*/
            //--></script>
        </div>
    </div>

</div>

